// Copyright (c) Microsoft Corporation.  All rights reserved.

using System;
using System.Collections.Generic;
using System.Text;

namespace PfRep.Console
{
    public class CommonUiHelper
    {
        public static void SaveIndexingAttributes(
            string username,
            string url)
        {
            // Save the username and last URL
            Common.Config.SetConfigValue("LastUsername", username);
            Common.Config.SetConfigValue("LastUrl", url);

            // Save the URL to history
            string enteredUrls = Common.Config.GetConfigValue("UrlHistory");
            if (string.IsNullOrEmpty(enteredUrls) || enteredUrls.Length == 0)
                enteredUrls = ";" + url + ";";
            else if (!enteredUrls.Contains(";" + url + ";"))
                enteredUrls = enteredUrls + url + ";";
            Common.Config.SetConfigValue("UrlHistory", enteredUrls);
        }
    }
}
